/* 
 * PageGenerator.java      1.00    2008-01-23
 *
 * Copyright (c) 2010 frida. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information
 * of frida.  You shall not disclose such Confidential Information
 * and shall use it only in accordance with the terms of the license agreement
 * you entered into with frida.
 */
package doit.framework.util;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

/**
 * <pre>
 * system      : 공통
 * menu        : 공통
 * source      : PageGenerator.java
 * description : 페이징 생성
 * </pre> 
 * @version
 * <pre> 
 * 1.0	2008-01-23  frida  최초 작성
 * 1.1	
 * </pre>
 */
@SuppressWarnings("unchecked")
public class PageGenerator {
	
	public Map generate( HttpServletRequest request, Map input, Map output) {
		if( output == null)
			output = new HashMap();
		
		String rows = output.get("count") != null ? output.get("count").toString() : "0";

		PageNavigator paging = new PageNavigator( 
				request,
				(String)input.get( PageUtils.PGI_PAGE), 
				rows,
				(String)input.get( PageUtils.PGI_ROWS_PER_PAGE), 
				(String)input.get( PageUtils.PGI_PAGES_PER_INDEX), 
				(String)input.get( PageUtils.PGI_ORDER_BY),
				(String)input.get( PageUtils.PGI_LOCATION),
				(String)input.get( PageUtils.PGI_METHOD)
				).generatePageBean();
		
		output.put("paging", paging);
		
		return output;
	}
}
